#!/bin/sh

USE_DISPLAY=:7
WM_CMD="install/bin/parti --sync"

RUN=$WM_CMD
#RUN="pydb --trace $WM_CMD"
#RUN="pydb --fntrace $WM_CMD"
#RUN="xterm -display $DISPLAY -e 'gdb --args python $WM_CMD --display=$USE_DISPLAY'"
#RUN="xtrace -n | tee xtrace.out & (sleep 1; python $WM_CMD --display=:9)"

. ./do-build
# The library path may be named lib, lib64, etc.:
LIBPATH=$(echo $PWD/install/lib*/python)
# NB Xephyr has a segfault bug in its reset logic -- shouldn't come up
# when run via xinit like this, but use -noreset anyway.
PYTHONPATH=$LIBPATH:$PYTHONPATH PATH=install/bin:$PATH xinit /bin/sh -c "x-terminal-emulator || xterm & $RUN" -- /usr/bin/Xephyr $USE_DISPLAY -ac -noreset